VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form FrmChatserver 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Chat Server"
   ClientHeight    =   4770
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7470
   Icon            =   "FrmChatserver.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4770
   ScaleWidth      =   7470
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtcount 
      Height          =   375
      Left            =   600
      TabIndex        =   2
      Top             =   5160
      Width           =   615
   End
   Begin VB.Timer tmrchat 
      Interval        =   1000
      Left            =   120
      Top             =   5160
   End
   Begin VB.CommandButton CmdSend 
      Caption         =   "Kirim"
      Height          =   495
      Left            =   5520
      TabIndex        =   1
      Top             =   4200
      Width           =   1815
   End
   Begin VB.TextBox txtchat 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   120
      TabIndex        =   0
      Top             =   4200
      Width           =   5295
   End
   Begin ComctlLib.ListView lvbar 
      Height          =   3975
      Left            =   120
      TabIndex        =   3
      Top             =   120
      Width           =   7215
      _ExtentX        =   12726
      _ExtentY        =   7011
      View            =   3
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   327682
      ForeColor       =   49152
      BackColor       =   0
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   3
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "No"
         Object.Width           =   0
      EndProperty
      BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   1
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "User"
         Object.Width           =   1764
      EndProperty
      BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   2
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Pesan"
         Object.Width           =   8819
      EndProperty
   End
End
Attribute VB_Name = "FrmChatserver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdSend_Click()
rec.Open "chat", conn, adOpenStatic, adLockOptimistic
rec.AddNew
rec(0) = 2
rec(1) = FrmMain.usnm.Text & " : " & txtchat.Text
rec(2) = Format(Now, "hh:mm:ss")
rec(3) = 0
rec.Update
rec.Close
txtchat.Text = ""
End Sub

Private Sub Form_Unload(Cancel As Integer)
rec.Open "Delete chat.* from chat", conn, adOpenStatic, adLockOptimistic
End Sub

Private Sub tmrchat_Timer()
loadpenj
If lvbar.ListItems.Count >= 17 Then
rec.Open "Delete chat.* from chat", conn, adOpenStatic, adLockOptimistic
End If

End Sub

Private Sub loadpenj()
lvbar.ListItems.Clear
rec.Open "chat", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close
Else
With rec
While Not .EOF
Set lstItem = lvbar.ListItems.Add(, , lvbar.ListItems.Count + 1 & ".")
If rec(0) = 1 Then
lstItem.SubItems(1) = "AdminServer"
ElseIf rec(0) = 2 Then
lstItem.SubItems(1) = "Me"
End If
lstItem.SubItems(2) = rec(1)
.MoveNext
Wend
End With
rec.Close
End If
End Sub

Private Sub txtchat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
CmdSend_Click
End If
End Sub
